-
-
Notifications
You must be signed in to change notification settings - Fork 9.4k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Core: Only use dotenv-webpack when a user has a dotenv file #15365
Conversation
Nx Cloud ReportCI ran the following commands for commit 1aca2f1. Click to see the status, the terminal output, and the build insights. 📂 See all runs for this branch
Sent with 💌 from NxCloud. |
Nx Cloud ReportWe didn't find any information for the current pull request with the commit 2d4f2f5. Check the Getting started section to configure the app. Sent with 💌 from NxCloud. |
import path from 'path'; | ||
|
||
// https://github.com/mrsteele/dotenv-webpack/blob/master/src/index.js#L34 | ||
const DOTENV_FILE = path.join('.', '.env'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Aren't some people defining special environment specific .env files which get auto-loaded?
.prod.env
etc?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not in our current setup. dotenv-webpack
has options to support that, but we don't pass those options in.
Core: Only use dotenv-webpack when a user has a dotenv file
Issue: #14257
What I did
Get rid of webpack5 warning when
dotenv-webpack
'sprocess.env
definition conflicts with our ownDefinePlugin
usage by simply not using the plugin unless the user has a.env
file in the current directory.This was not a problem in Webpack4, but has gotten more strict in Webpack5.
This PR does not solve the problem where users DO have a
.env
file, but it should remove spurious warnings for users that DON'T.How to test
Not easy to test in the current monorepo setup because we cannot run webpack5